﻿<%@ Page Title="" Language="C#" MasterPageFile="~/masterPage/Site.master" AutoEventWireup="true" Inherits="Usuarios" Codebehind="Usuarios.aspx.cs" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<h2>Usuarios</h2>
    <p>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConflictDetection="CompareAllValues" 
            ConnectionString="<%$ ConnectionStrings:BarCafeConnectionString %>" 
            DeleteCommand="DELETE FROM [Usuario] WHERE [Id_Usuario] = @original_Id_Usuario AND (([Nombre] = @original_Nombre) OR ([Nombre] IS NULL AND @original_Nombre IS NULL)) AND (([Apellido] = @original_Apellido) OR ([Apellido] IS NULL AND @original_Apellido IS NULL)) AND (([Nro_Doc] = @original_Nro_Doc) OR ([Nro_Doc] IS NULL AND @original_Nro_Doc IS NULL))" 
            InsertCommand="INSERT INTO [Usuario] ([Nombre], [Apellido], [Nro_Doc]) VALUES (@Nombre, @Apellido, @Nro_Doc)" 
            OldValuesParameterFormatString="original_{0}" 
            SelectCommand="SELECT [Id_Usuario], [Nombre], [Apellido], [Nro_Doc] FROM [Usuario]" 
            UpdateCommand="UPDATE [Usuario] SET [Nombre] = @Nombre, [Apellido] = @Apellido, [Nro_Doc] = @Nro_Doc WHERE [Id_Usuario] = @original_Id_Usuario AND (([Nombre] = @original_Nombre) OR ([Nombre] IS NULL AND @original_Nombre IS NULL)) AND (([Apellido] = @original_Apellido) OR ([Apellido] IS NULL AND @original_Apellido IS NULL)) AND (([Nro_Doc] = @original_Nro_Doc) OR ([Nro_Doc] IS NULL AND @original_Nro_Doc IS NULL))">
            <DeleteParameters>
                <asp:Parameter Name="original_Id_Usuario" Type="Int32" />
                <asp:Parameter Name="original_Nombre" Type="String" />
                <asp:Parameter Name="original_Apellido" Type="String" />
                <asp:Parameter Name="original_Nro_Doc" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="Nombre" Type="String" />
                <asp:Parameter Name="Apellido" Type="String" />
                <asp:Parameter Name="Nro_Doc" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="Nombre" Type="String" />
                <asp:Parameter Name="Apellido" Type="String" />
                <asp:Parameter Name="Nro_Doc" Type="String" />
                <asp:Parameter Name="original_Id_Usuario" Type="Int32" />
                <asp:Parameter Name="original_Nombre" Type="String" />
                <asp:Parameter Name="original_Apellido" Type="String" />
                <asp:Parameter Name="original_Nro_Doc" Type="String" />
            </UpdateParameters>
        </asp:SqlDataSource>
        <asp:FormView ID="FormView1" runat="server" AllowPaging="True" 
            DataKeyNames="Id_Usuario" DataSourceID="SqlDataSource1" Width="915px" 
            CellPadding="4" ForeColor="#333333">
            <EditItemTemplate>
                Id_Usuario:
                <asp:Label ID="Id_UsuarioLabel1" runat="server" 
                    Text='<%# Eval("Id_Usuario") %>' />
                <br />
                Nombre:
                <asp:TextBox ID="NombreTextBox" runat="server" Text='<%# Bind("Nombre") %>' 
                MaxLength="20"  onkeypress="return  isLetter()"/>
                  <asp:RequiredFieldValidator ID="rfNombreTextBox" runat="server" ErrorMessage="*"
                ControlToValidate="NombreTextBox" EnableClientScript="True" />
                <br />
                Apellido:
                <asp:TextBox ID="ApellidoTextBox" runat="server"  onkeypress="return  isLetter()"
                    Text='<%# Bind("Apellido") %>' MaxLength="20"/>
                     <asp:RequiredFieldValidator ID="RequiredFieldValidator1ApellidoTextBox" runat="server" ErrorMessage="*"
                ControlToValidate="ApellidoTextBox" EnableClientScript="True" />
                <br />
                Nro_Doc:
                <asp:TextBox ID="Nro_DocTextBox" runat="server" Text='<%# Bind("Nro_Doc") %>' MaxLength="8" 
                onkeypress="return  isNumber()"/>
                 <asp:RequiredFieldValidator ID="RequiredFieldValidator2Nro_DocTextBox" runat="server" ErrorMessage="*"
                ControlToValidate="Nro_DocTextBox" EnableClientScript="True" />
                <br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="Actualizar" />
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
            </EditItemTemplate>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <InsertItemTemplate>
                Nombre:
                <asp:TextBox ID="NombreTextBox" runat="server" Text='<%# Bind("Nombre") %>' />
                <br />
                Apellido:
                <asp:TextBox ID="ApellidoTextBox" runat="server" 
                    Text='<%# Bind("Apellido") %>' />
                <br />
                Nro_Doc:
                <asp:TextBox ID="Nro_DocTextBox" runat="server" Text='<%# Bind("Nro_Doc") %>' />
                <br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="Insertar" />
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
            </InsertItemTemplate>
            <ItemTemplate>
                Id_Usuario:
                <asp:Label ID="Id_UsuarioLabel" runat="server" 
                    Text='<%# Eval("Id_Usuario") %>' />
                <br />
                Nombre:
                <asp:Label ID="NombreLabel" runat="server" Text='<%# Bind("Nombre") %>' />
                <br />
                Apellido:
                <asp:Label ID="ApellidoLabel" runat="server" Text='<%# Bind("Apellido") %>' />
                <br />
                Nro_Doc:
                <asp:Label ID="Nro_DocLabel" runat="server" Text='<%# Bind("Nro_Doc") %>' />
                <br />
                <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                    CommandName="Edit" Text="Editar" />
            </ItemTemplate>
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        </asp:FormView>
    </p>
    <p>&nbsp;</p>

</asp:Content>

